package com.surelution.lansao.wxmp.partner

import java.util.List;

import com.surelution.lansao.Partner
import com.surelution.lansao.PartnerRequiredOperation
import com.surelution.whistle.core.Attribute

class IdNumberRequiredSub extends RequiredBaseSub {

	@Override
	public boolean accept() {
		return true;
	}


	@Override
	public List<Attribute> process() {
		def idNumber = host.getParam(Attribute.KEY_Content)
		if(idNumber) {
			def id = host.partner.id
			Partner p = Partner.get(id)
			p.idCardNo = idNumber
			operation.delete()

			PartnerRequiredOperation nextOperation = new PartnerRequiredOperation(partner:p, forever:true, className:IDCardPhotoRequiredSub.class.name)
			nextOperation.save()
			return [new Attribute(Attribute.KEY_Content, "请回复您的身份证的照片给我们。身份证照片是微信公司需要，本公司承诺绝不会在其他任何场合使用您的身份证照片！")]
		}
		return [new Attribute(Attribute.KEY_Content, "请回复您的身份证号")];
	}

}
